﻿using System;
using System.Collections.Generic;
using System.Text;
using ilibrary.source.model.metasearch;

namespace ilibrary.source.model
{
    /// <summary>
    /// Interface representant un ebook. 
    /// </summary>
    public interface IEbook
    {
        #region DataFields
        /// <summary>
        /// Get the Id of the ebook
        /// </summary>
        int Id { get; }

        /// <summary>
        /// Get or set the filepath of the ebook 
        /// <returns></returns>
        String Filepath { get; set; }

        /// <summary>
        /// Get or set the file title of the ebook
        /// </summary>
        /// <returns></returns>
        String Title { get; set; }

        /// <summary>
        /// Get or set the authors of the ebook
        /// </summary>
        String Authors { get; set; }

        /// <summary>
        /// Get or set the publisher of the ebook
        /// </summary>
        String Publisher { get; set; }

        /// <summary>
        /// Get or set the description of the ebook
        /// </summary>
        String Description { get; set; }

        /// <summary>
        /// Get or set the ISBN of the ebook
        /// </summary>
        String ISBN { get; set; }

        /// <summary>
        /// Get or set the url of the image
        /// </summary>
        String ImageUrl { get; set; }

        /// <summary>
        /// Get or set the summary of the ebook
        /// </summary>
        String Summary { get; set; }
        #endregion

        #region Additionnal DataFields
        /// <summary>
        /// Get the directory containing the ebook
        /// </summary>
        /// <returns></returns>
        String Directory { get; }

        /// <summary>
        /// Returns the size of the ebook file
        /// </summary>
        /// <returns></returns>
        long Size { get; }

        /// <summary>
        /// Returns the ebook type (PDF,CHM,...)
        /// </summary>
        /// <returns></returns>
        string Type { get; }

        /// <summary>
        /// Get Ebook TOC. No loading occurs
        /// </summary>
        String TOC {get;}

        /// <summary>
        /// Get ebook TOC and load it if necessary
        /// </summary>
        /// <returns></returns>
        string getTOC(IEBookReadingHandler handler);
        #endregion

        #region Other Functions
        /// <summary>
        /// XML serialized representation of the ebook
        /// </summary> 
        /// <returns></returns>
        String toXML();

        /// <summary>
        /// Set Book Metadata from Internet Search and persist them to the Sqllite Database
        /// </summary>
        /// <param name="info"></param>
        void SetMetadataInfo(DBResult info);

        /// <summary>
        /// initialize TOC reading from file
        /// </summary>
        /// <param name="cB"></param>
        /// <returns></returns>
        bool readToc(IEBookReadingHandler cB);
        #endregion

        #region Test Functions
        /// <summary>
        /// Checks whether the specified path exists physically
        /// </summary>
        /// <returns></returns>
        bool isOnDisk();
        #endregion
    }
}
